# $Id: PKGBUILD 177996 2013-02-12 21:19:19Z eric $
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=mutagen
pkgver=1.21
pkgrel=1
pkgdesc="An audio metadata tag reader and writer"
arch=('any')
url="http://code.google.com/p/mutagen/"
license=('GPL2')
depends=('python2')
source=(http://mutagen.googlecode.com/files/${pkgname}-${pkgver}.tar.gz{,.sig})
sha1sums=('21807dd51f36204891597a368bfa2fab1a30a531'
          'eed8028a1caaa16ac0b7872ce4b683f9c60a5856')

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  python2 setup.py test
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  python2 setup.py install --root="${pkgdir}"
  install -d "${pkgdir}/usr/bin"
  install -m755 tools/* "${pkgdir}/usr/bin"
  sed -i 's|^#!.*/usr/bin/env.*python|#!/usr/bin/env python2|' "${pkgdir}"/usr/bin/* \
    "${pkgdir}/usr/lib/python2.7/site-packages/mutagen/__init__.py"
}
